<?php

/**
* 加载sdk包以及错误代码包
*/
require_once 'sdk.class.php';
		$oss_sdk_service = new ALIOSS();
		$oss_sdk_service->set_debug_mode(FALSE);
		$oss_sdk_service->set_enable_domain_style(TRUE);
		$bucket = "fanzhx";
		
		
		$content = '';
		$length = 0;
		$fp = fopen($_FILES["Filedata"]["tmp_name"],'r');
		if($fp)
		{
			$f = fstat($fp);
			$length = $f['size'];
			while(!feof($fp))
			{
				$content .= fgets($fp,8192);
			}
		}
		$upload_file_options = array('content' => $content, 'length' => $length);
		$oss_sdk_service->upload_file_by_content($bucket, $_FILES["Filedata"]["name"],$upload_file_options);
		$img_url = "http://" . $bucket . ".oss-cn-hangzhou.aliyuncs.com/" . $_FILES["Filedata"]["name"];
		 //echo $img_url;
		echo $img_url;
		
?>